﻿using System;
using System.Collections.Generic;
using System.IO;
using Terraria.ModLoader.IO;

namespace Terraria.ModLoader.Default
{
	// Token: 0x02000308 RID: 776
	public class MysteryPlayer : ModPlayer
	{
		// Token: 0x06001D78 RID: 7544 RVA: 0x00014EB7 File Offset: 0x000130B7
		public override void Initialize()
		{
			this.data = new List<TagCompound>();
		}

		// Token: 0x06001D79 RID: 7545 RVA: 0x00014EC4 File Offset: 0x000130C4
		public override TagCompound Save()
		{
			TagCompound tagCompound = new TagCompound();
			tagCompound["list"] = this.data;
			return tagCompound;
		}

		// Token: 0x06001D7A RID: 7546 RVA: 0x00014EDC File Offset: 0x000130DC
		public override void Load(TagCompound tag)
		{
			PlayerIO.LoadModData(base.player, tag.GetList<TagCompound>("list"));
		}

		// Token: 0x06001D7B RID: 7547 RVA: 0x00439460 File Offset: 0x00437660
		public override void LoadLegacy(BinaryReader reader)
		{
			List<TagCompound> list = new List<TagCompound>();
			int num = (int)reader.ReadUInt16();
			for (int i = 0; i < num; i++)
			{
				List<TagCompound> list2 = list;
				TagCompound tagCompound = new TagCompound();
				tagCompound["mod"] = reader.ReadString();
				tagCompound["name"] = reader.ReadString();
				tagCompound["legacyData"] = reader.ReadBytes((int)reader.ReadUInt16());
				list2.Add(tagCompound);
			}
			TagCompound tagCompound2 = new TagCompound();
			tagCompound2["list"] = list;
			this.Load(tagCompound2);
		}

		// Token: 0x06001D7C RID: 7548 RVA: 0x004394E4 File Offset: 0x004376E4
		public override void SetupStartInventory(IList<Item> items)
		{
			if (AprilFools.CheckAprilFools())
			{
				Item item = new Item();
				item.SetDefaults(base.mod.ItemType("AprilFools"), false);
				items.Add(item);
			}
		}

		// Token: 0x04001901 RID: 6401
		internal IList<TagCompound> data;
	}
}
